<template>
  <Spin :spinning="loading" tip="Loading...">
  <div>
    <!-- table -->
    <BreakSpace label="工单及车辆信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel1" :list="formList" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle1" />
    <BaseDialog :visible.sync="weixiugongdan" :title="'维修工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <SelectWeiXiuGongDan @close="weixiugongdanClose" @save="weixiugongdanSave"></SelectWeiXiuGongDan>
    </BaseDialog>
    <BaseDialog :visible.sync="zhusunjian" :title="'主损件选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectzhusunjian @close="zhusunjianClose" @save="zhusunjianSave"></Selectzhusunjian>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangxianxiangdaima" :title="'故障现象选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectguzhangxianxiang @close="guzhangxianxiangdaimanClose" @save="guzhangxianxiangdaimaSave"></Selectguzhangxianxiang>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangyuanyin" :title="'故障原因选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectguzhangyuanyin @close="guzhangyuanyinClose" @save="guzhangyuanyinSave"></Selectguzhangyuanyin>
    </BaseDialog>
    <BaseDialog :visible.sync="zifeigongdanFlag" :title="'自费工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectzifeigongdan @close="zifeigongdanClose" @save="zifeigongdanSave"></Selectzifeigongdan>
    </BaseDialog>
    <BaseDialog :visible.sync="jiuyuandanFlag" :title="'救援单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectjiuyuandan @close="jiuyuandanClose" @save="jiuyuandanSave"></Selectjiuyuandan>
    </BaseDialog>
    <BaseDialog :visible.sync="weixiuxiangmulistaddflag" :title="'维修项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Weixiuxiangmulist @close="weixiuxiangmulistClose" @save="weixiuxiangmulistSave"></Weixiuxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="peijianhuanshangjianlistaddflag" :title="'配件换上件列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Peijianhuanshangjianlist @close="peijianhuanshangjianClose" @save="peijianhuanshangjianSave"></Peijianhuanshangjianlist>
    </BaseDialog>
    <BaseDialog :visible.sync="fujiaxiangmulistaddflag" :title="'附加项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <fujiaxiangmulist @close="fujiaxiangmuClose" @save="fujiaxiangmuSave"></fujiaxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="isvideo" :title="'视频预览'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <videos @close="dealercloseHandler" :src="src"/>
    </BaseDialog>
    <BaseDialog :title="'上传附件'" :visible.sync="upVisible" destroyOnClose>
      <uploadFile :rowData="uploadDate" @close="upVisible = false" @save="saveFile"></uploadFile>
    </BaseDialog>
    <BreakSpace label="索赔信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel2" :list="formList1" :cols="4" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle2" />
    <BreakSpace label="上传视频/压缩文件" :containerStyle="{ marginBottom: '10px' }" />
    <!--    <UploadFile action-url="/api/file/oss/upload" :initial-value="form.fileList" :fileTypes="['mp4','avi','rmvb','WMV']" :fileSize="100" :isOnlyButton="true"  :limit="10000" @change="successHandler">上传附件</UploadFile>-->
    <FilterTable
      ref="fileTable"
      :columns="columnsFile"
      columnsRef="whbydUploadFile"
      :isSelectColumn="false"
      :onColumnsChange="columnsFile => (this.columnsFile = columnsFile)"
      height=auto
      :dataSource="list"
    />
    <BreakSpace label="维修项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <BaseDialog :visible.sync="remarkFlag" :title="'审核备注选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <selectDelearPage @close="weixiugongdanClose" @save="weixiugongdanSave"></selectDelearPage>
    </BaseDialog>
    <FilterTable
      ref="weixiuxiangmutable"
      :columns="columns"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns) => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      height="auto"
      :isPagination=false
    >
    </FilterTable>
    <div style="margin-bottom: 1rem"></div>
    <BreakSpace label="配件换上件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="peijianhuanshangjiantable"
      :columns="columns1"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns1) => (this.columns1 = columns1)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      height="auto"
      :isPagination=false
    >
    </FilterTable>
    <BreakSpace label="配件换下件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table2"
      :columns="columnshuanxiajian"
      :params="fetchParams"
      :dataSource="huanxiajiandataList"
      :datakey="'items'"
      :onColumnsChange="(columnshuanxiajian) => (this.columnshuanxiajian = columnshuanxiajian)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      :isPagination="false"
      height="auto"
    >
      <template slot="controls" slot-scope="props">
        <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanxiajianadd()">添加</multiuse-button>-->
      </template>
    </FilterTable>
    <BreakSpace label="附加项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="fujiaxiangmutable"
      :columns="columnsfujiaxiangmu"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columnsfujiaxiangmu) => (this.columnsfujiaxiangmu = columnsfujiaxiangmu)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      height="auto"
      :isPagination=false
    >
    </FilterTable>
    <BreakSpace label="费用信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel3" :list="feiyongformList" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle3" />
    <LazyLoadTab v-model="activeName" :tabMenus="menus"></LazyLoadTab>
    <BreakSpace label="审核备注" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanelbeizhu" :list="formListbeizhu" :cols="1" :formType="'add'" labelWidth="200" :isSubmitBtn="false" @formChange="formChangeHandle4" />
    <div style="padding-top: 3rem"></div>
    <div style="padding-top: 3rem"></div>
    <div
      :style="{
        position: 'fixed',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <!--      <multiuse-button @click="zuofei">作废</multiuse-button>-->
      <!--      <multiuse-button type="primary" @click="saveDialog">保存</multiuse-button>-->
     <!--  <multiuse-button :click="submit.bind()" :disabled="this.rowData.authStatus==55031001 ||this.rowData.authStatus== 55031002 || this.rowData.authStatus== 55031004|| this.rowData.authStatus== 55031005|| this.rowData.authStatus== 55031006">撤销审核</multiuse-button>-->
      <multiuse-button type="primary" @click="closeDialog">关 闭</multiuse-button>
    </div>
  </div>
  </Spin>
</template>
<script>
import { newSave, editSave, quyRpPreAuth, quyRomessage, getSupplierList, zuofeiFun, cmsClaimTypeStr,backAduit } from '@/api/claim/factory/AuthQueryFactory';
import { isFormEmpty } from '@/utils/index';
import {translateByVinAndModelCode } from '@/api/claim/dealer/AuthApplication';
import { isSpecialCar ,queryRepairVehicleList} from  '@/api/claim/factory/AuthCheck';
import { dictionary } from '@/utils/dictMixin';
import { getRoLogList } from '@/api/claim/dealer/ClaimApplication/index';
import uploadFile from '@/pages/claimDemage/BasicData/AuthQueryDealer/uploadFile.vue';
//import { queryRepairVehicleList } from '@/api/repair/common';
import selectDelearPage from "../ClaimCheck/selectDelearPage";
import { getPartType,getClaim } from '@/api/dictionary/index';
import moment from 'moment';
import videos from '@/pages/claimDemage/BasicData/AuthApplication/videos.vue'
export default {
  mixins: [dictionary],
  props: ['type', 'rowData1','rowData'],
  components: {
    selectDelearPage,
    videos,
    uploadFile
  },
  data() {
    return {
      form: {
        fileList: []
      },
      src:null,
      list: [],
      isvideo:false,
      syncList: [],
      columnsFile: this.createdTable(),
      loading: false,
      uploadDate: {},
      upVisible: false,
      saveData: {}, //保存对象
      saveData1: null,
      saveData2: null,
      saveData3: null,
      partId: null,
      supId: null,
      saveFlag: 0,
      authNo: null,
      faId: null,
      frId: null,
      addAmount: null,
      supCode: null,
      isDeleted: null,
      jiuyuandanFlag: false,
      faultAppear: null,
      labourAmount: null,
      partAmount: null,
      modelId: null,
      modelCode: null,
      outId: null,
      outName: null,
      dataList: [],
      dataList1: [],
      weixiuxiangmudataList: [],
      peijianhuanshangjiandataList: [],
      peijianhuanxiajiandataList: [],
      fujiaxiangmudataList: [],
      huanxiajiandataList:[],
      visible: false,
      visibleDrawer: false,
      fujiaxiangmuCloselistaddflag: false,
      weixiuxiangmulistaddflag: false,
      peijianhuanshangjianlistaddflag: false,
      fujiaxiangmulistaddflag: false,
      peijianhuanxiajianlistaddflag:false,
      collapse: false,
      zifeigongdanFlag: false,
      weixiugongdan: false,
      guzhangyuanyin: false,
      zhusunjian: false,
      guzhangxianxiangdaima: false,
      infoId: null,
      // topFilterInit: this.topFilterInitFun(),
      flterValue: {}, //参数
      columns: this.creatHeader(),
      columns1: this.creatHeader1(),
      columnsfujiaxiangmu: this.columnsfujiaxiangmu1(),
      formListbeizhu: this.formListbeizhuform(),
      columnshuanxiajian: this.columnshuanxiajianFn(),
      // fetchApi: getUser,
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      hejifeiyong: 0.0,
      gongshifeiyong: 0.0,
      peijianfeiyong: 0.0,
      sumfujiafeiyongz: 0,
      sumweixiufeiyongz: 0,
      partAmountsumz: 0,
      sumfujiafeiyong: 0,
      sumPeiJianFeiYong: 0,
      fujiaxiangmufeiyong: 0.0,
      remarkFlag:false,
      formList: this.createFormList(),
      formList1: this.createFormList1(),
      feiyongformList: this.feiyongformList1(),
      activeName: '审核记录',
      menus: [
        {
          title: '审核记录',
          path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/shenhejilu',
          params: {
            authId: this.rowData.authId,
          },
        },
        {
          title: '维修历史',
          path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/weixiulishi',
          // disabled: true,
          params: {
            vin: this.rowData.vin,
          },
        },
        {
          title: '索赔历史',
          path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/suopeilishi',
          // disabled: true,
          params: {
            vin: this.rowData.vin,
          },
        },
        {
          title: '变更记录',
          path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/biangengjilu',
          // disabled: true,
          params: {
            authId: this.rowData.authId,
          },
        },
        {
            title: '预授权历史',
            path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/preAuth',
            // disabled: true,
            params: {
              vin:this.rowData.vin,
            }
        },
      ],
    };
  },
  created() {
    this.loading = true;
    this.Sum();
    this.getCmsClaimTypeStr();
    //this.getSupplierListStr();
    this.chuqi();
    this.loading = false;
  },
  async mounted() {
    console.log('************321');
    //console.log(this.$refs.fujiaxiangmutable.$refs.pageTable.GET_UPDATE_ROWS());
    this.getAuthListByauthNo(this.rowData.authId);
    await this.queryRepairVehicleMessage(this.rowData.vin,this.rowData.ownerCode);
  },
  methods: {
    dealercloseHandler(){
      this.isvideo = false;
    },
    // 上传成功回调
    successHandler(val) {
      let json = JSON.parse(JSON.stringify(val));
      let data = {};
      data.createdAt = moment().format('YYYY-MM-DD HH:mm:ss');
      data.title = json[json.length - 1].name;
      data.fileUrl = json[json.length - 1].url;
      this.$refs.fileTable.$refs.pageTable.EXECUTE_INSERT(data);
    },
    video(val){
      this.isvideo = true;
      this.src = val.fileUrl;
    },
    delVideo(val){
      console.log("#@!#!",val)
      this.$refs.fileTable.$refs.pageTable.EXECUTE_DELETE([val]);
    },
    async queryRepairVehicleMessage(val,val1) {
      //掉外部接口 vin
      console.log("1111111111111")
      let res = await queryRepairVehicleList({ vin: val,ownerCode:val1 });
      //是否特殊车
      //let res1 = await isSpecialCar(val);
      let isSpecialResult = await translateByVinAndModelCode({vin:res.data.rows[0].VIN,modelCode: res.data.rows[0].MODEL_CODE,customerType: res.data.rows[0].BUSINESS_KIND});
      console.log("222222222222")
     // let data = res1.data;
      if(isSpecialResult.data){
      this.formList.map(x => {
        //是否特殊车
        if ('isSpecial' == x.fieldName) {
          x.initialValue =this.createDictText(Number(isSpecialResult.data.isSpecial), '5532');
        }
      });
      }
  if(res.data.rows.length){
  this.formList.map(x => {
    //车主姓名
    if ('customerName' == x.fieldName) {
      x.initialValue =res.data.rows[0].DELIVERER;
    }
    //车主手机号
    if ('customerPhone' == x.fieldName) {
      x.initialValue =res.data.rows[0].DELIVERER_MOBILE;
    }
    //车辆用途
    if ('useType' == x.fieldName) {
      x.initialValue =this.createDictText(res.data.rows[0].VEHICLE_PURPOSE, '1511');
    }
    //用户属性
    if ('customerType' == x.fieldName) {
      //x.initialValue =this.createDictText(res.data.rows[0].BUSINESS_KIND, '4103');
      x.initialValue =this.createDictText(Number(isSpecialResult.data.customerType), '5584');
    }
  });

};

    },
    //索赔类型下拉
    async getCmsClaimTypeStr() {
      // const res = await cmsClaimTypeStr({ type: 5501 });
      // if (res.resultCode == 200) {
      //   this.formList1.find((x) => x.fieldName == 'cmsClaimType').initialValue = '';
      //   this.formList1.find((x) => x.fieldName == 'cmsClaimType').itemList = res.data.map((y) => ({ text: y.codeCnDesc, value: y.codeId }));
      // }
      const res2 = await getClaim();
      if (res2.resultCode == 200) {
        this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = '';
        this.formList1.find(x => x.fieldName == 'cmsClaimType').itemList = res2.data.map(y => ({ text: y.name, value: y.code }));
      }
    },
    formChangeHandle4(val) {
      console.log(val);
      this.saveData5 = val;
    },
    //供应商下拉
    async getSupplierListStr() {
      const res = await getSupplierList();
      if (res.resultCode == 200) {
        this.formList1.find((x) => x.fieldName == 'supName').initialValue = '';
        this.formList1.find((x) => x.fieldName == 'supName').itemList = res.data.map((y) => ({ text: y.supName, value: y.supCode }));
      }
    },
    sumAmount() {
      let sum = 0;
      this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
        sum += Number(x.addAmount);
      });

      this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
        sum += Number(x.cmsClaimAmount);
      });

      this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
        sum += Number(x.cmsClaimPrice);
      });

      this.feiyongformList.map((x) => {
        if ('sumAmount' == x.fieldName) {
          x.initialValue = sum;
        }
      });
    },
    async getAuthListByauthNo(authNo) {
      let res = await quyRpPreAuth(authNo);
      let data = res.data;
      //临时属性
      this.partId = data.partId; //主损件id
      this.supId = data.supId; //供应商ID
      this.supCode = data.supCode; //供应商Code
      this.faultAppear = data.faultAppear; //故障现象
      this.labourAmount = data.labourAmount; //工时费用
      this.partAmount = data.partAmount; //配件费用
      this.modelId = data.modelId; //车型id
      this.modelCode = data.modelCode; //车型Code
      this.faId = data.faId; //故障现象主键
      this.isDeleted = data.isDeleted;
      this.addAmount = data.addAmount;
      this.sumfujiafeiyongz = data.addAmount;
      this.sumweixiufeiyongz = data.labourAmount;
      this.partAmountsumz = data.partAmount;
      this.menus[1].params.vin = data.vin;
      if(data.saleDate){
        data.saleDate = moment(data.saleDate).format('YYYY-MM-DD');
      }
      if(data.repairBeginDate){
        data.repairBeginDate = moment(data.repairBeginDate).format('YYYY-MM-DD');
      }
      if(data.repairEndDate){
        data.repairEndDate = moment(data.repairEndDate).format('YYYY-MM-DD');
      }
      console.log(data.outId);
      this.outId = data.outId;
      this.outCode = data.outCode;

      this.frId = data.frId; //故障原因主键

      // this.prodDate = data.prodDate;
      let wxLog = await getRoLogList({vin:data.vin,current:1,limit:100,currentPage:1,pageNum:1,pageSize: 100,size: 100});
      if(wxLog.data.rows.length>=2){
        data.lastDrive = wxLog.data.rows[wxLog.data.rows.length-2].IN_MILEAGE;
      }else{
        data.lastDrive = 0
      }
      //为3个form赋值
      for (let i in data) {
        this.formList.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
        this.formList1.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
          if (y.fieldName == 'outCode') {
            y.initialValue = data['outNo'];
          }
        });
        this.feiyongformList.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
      }
      //为table赋值

        for (let i in data.fileList) {
          if(data.fileList[i].type==55041001) {
            this.formList1.find(x => x.fieldName == 'wayPicture').initialValue =  [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }else if(data.fileList[i].type==55041002) {
            this.formList1.find(x => x.fieldName == 'wayPicture1').initialValue = [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }else if(data.fileList[i].type==55041003) {
            this.formList1.find(x => x.fieldName == 'wayPicture2').initialValue = [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }else if(data.fileList[i].type==55041004) {
            this.formList1.find(x => x.fieldName == 'wayPicture3').initialValue = [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }else if(data.fileList[i].type==55041005) {
            this.formList1.find(x => x.fieldName == 'wayPicture4').initialValue = [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }else if(data.fileList[i].type==55041006) {
            this.formList1.find(x => x.fieldName == 'wayPicture5').initialValue = [{url : data.fileList[i].fileUrl,name : data.fileList[i].title}];
          }

        }
      let newFile = [];
      for(let i in data.fileList){
        if(data.fileList[i].type==null){
          newFile.push(res.data.fileList[i])
        }
      }
      this.$refs.fileTable.$refs.pageTable.EXECUTE_INSERT(newFile);
      if (200 == res.resultCode) {
        let data = res.data;
        if (isFormEmpty(data)) {
          data = {};
        }
        let records = data.labourList;
        if (isFormEmpty(records)) {
          records = [];
        }
        if (!isFormEmpty(records)) {
          records.map(x => {
            x.cmsClaimType='索赔';
          });
        }
        this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(records);
        let records1 = data.addList;
        if (isFormEmpty(records1)) {
          records1 = [];
        }
        this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(records1);
      }
      let records3 = data.partRList;
      if (isFormEmpty(records3)) {
        records3 = [];
      }
      this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(records3);
      let records2 = data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2);
      console.info(res);
    },
    async Sum() {
      console.log(99999);
      console.log(this.sumfujiafeiyong);
    },
    async chuqi() {
      // const res = await getPartType({ type: 5503 });
      // if (res.resultCode == 200) {
      //   this.formList.find((x) => x.fieldName == 'authStatus').initialValue = '';
      //   this.formList.find((x) => x.fieldName == 'authStatus').itemList = res.data.map((y) => ({ text: y.codeCnDesc, value: y.codeId }));
      // }
    },
    saveFile(obj){
      let list = this.$refs.fujiaxiangmutable.$refs.pageTable.list;
      list.find(x => x.addCode == obj.addCode).addFiles = obj.length==0 ? []:obj;
      this.upVisible = false;
    },
    editFile(row){
      this.upVisible = true;
      this.uploadDate = row;
      this.uploadDate.authId = this.rowData.authId;
    },
    formChangeHandle1(val) {
      console.log(val);
      this.saveData1 = val;
    },
    formChangeHandle2(val) {
      console.log(val);
      this.saveData2 = val;
    },
    formChangeHandle3(val) {
      console.log(val);
      this.saveData3 = val;
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //保存
    async saveDialog() {
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();

      let arr = [];
      this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
        arr.push(x);
      });
      console.log(arr);

      let arr2 = [];
      this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
        arr2.push(x);
      });
      console.log(arr2);

      let arr3 = [];
      this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
        arr3.push(x);
      });
      console.log(arr3);

      //维修项目
      this.saveData.labourList = arr3;
      //换上件
      this.saveData.partRList = arr2;
      //附加项目
      this.saveData.addList = arr;

      this.saveData = Object.assign(this.saveData, this.saveData1);

      this.saveData = Object.assign(this.saveData, this.saveData2);

      this.saveData = Object.assign(this.saveData, this.saveData3);

      console.log(this.saveData);
      this.saveData.authId = this.rowData.authId;

      this.saveData.partId = this.partId;
      this.saveData.supId = this.supId;
      this.saveData.supCode = this.supCode;
      this.saveData.labourAmount = this.labourAmount;
      this.saveData.partAmount = this.partAmount;
      this.saveData.modelId = this.modelId;
      this.saveData.modelCode = this.modelCode;
      this.saveData.faId = this.faId; //故障现象主键
      this.saveData.frId = this.frId; //故障原因主键
      this.saveData.outId = this.outId;
      this.saveData.isDeleted = this.isDeleted;
      this.saveData.outCode = this.outCode;
      //判断是保存还是提交 默认0 提交1 作废2
      if (this.saveFlag == 1) {
        this.saveData.authStatus = 55031002;
      } else if (this.saveFlag == 2) {
        this.saveData.authStatus = 55031006;
      } else {
        this.saveData.authStatus = 55031001;
      }
      //保存前格式化时间类型
      //销售日期
      this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      //保修起始日期
      this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修开始时间
      this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修结束时间
      this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      //自费配件销售日期
      // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      //生产日期
      this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');

      //编辑的保存
      let res = await editSave(this.saveData);

      if (res.resultCode === 200) {
        this.closeDialog('refresh');
        return this.$notify.success({ title: '提示信息', message: '保存成功' });
        this.$emit('save');
      } else {
        this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
        this.closeDialog();
      }
    },
    //维修项目列表新增
    weixiuxiangmulistadd() {
      this.weixiuxiangmulistaddflag = true;
    },
    //配件换上件列表
    peijianhuanshangjianadd() {
      this.peijianhuanshangjianlistaddflag = true;
    },
    peijianhuanshangjianlistadd() {
      this.peijianhuanshangjianlistaddflag = true;
    },
    //附加项目列表
    fujiaxiangmuadd() {
      this.fujiaxiangmulistaddflag = true;
    }, //救援单
    jiuyuandanClose() {
      this.jiuyuandanFlag = false;
    },
    jiuyuandanSave(obj) {
      this.outId = obj[0].outId;
      //救援单返显
      this.formList1.map((x) => {
        if ('outNo' == x.fieldName) {
          x.initialValue = obj[0].outCode; //救援号返显
        }
      });

      this.jiuyuandanFlag = false;
    },
    selectoutNo() {
      this.jiuyuandanFlag = true;
    },
    //维修工单
    weixiugongdanClose() {
      this.remarkFlag = false;
    },
    weixiugongdanSave(obj) {
      this.formListbeizhu.find(x => x.fieldName == 'checkRemarks').initialValue = obj[0].reasonRemarks;
      this.remarkFlag = false;
    },
    //主损件
    zhusunjianClose() {
      this.zhusunjian = false;
    },
    zhusunjianSave(obj) {
      this.partId = obj[0].partId;
      this.formList1.map((x) => {
        if ('partCode' == x.fieldName) {
          x.initialValue = obj[0].partCode; //主损件返显
        }
        if ('partName' == x.fieldName) {
          x.initialValue = obj[0].partName; //主损件返显
        }
        // if ('ncvcertnon' == x.fieldName) {
        //   x.initialValue = obj[0].certificateNo; //新车证件号
        // }
        // if ('ncvmobilen' == x.fieldName) {
        //   x.initialValue = obj.vtel; //客户电话
        // }
        // if ('ncvvinn' == x.fieldName) {
        //   x.initialValue = obj.vin; //vin
        // }
        // if ('ncvseriescoden' == x.fieldName) {
        //   x.initialValue = obj.seriesCode; //系列
        //   this.seriesCode = obj.seriesName;
        // }
        // if ('ncvseriesname' == x.fieldName) {
        //   x.initialValue = obj.seriesName; //车系名称
        //   this.seriesCode = obj.seriesName;
        // }

        // if ('ncvcartypecoden' == x.fieldName) {
        //   x.initialValue = obj.modelCode; //车型
        // }

        // if ('ncvcartypename' == x.fieldName) {
        //   x.initialValue = obj.salesModelName; //车型名称
        // }

        // if ('ncvbrandcoden' == x.fieldName) {
        //   x.initialValue = obj.brandCode; //品牌代码
        // }
        // if ('vengineanon' == x.fieldName) {
        //   //发动机号
        //   x.initialValue = obj.engineNo; //品牌代码
        // }
        // if ('vcertificateType' == x.fieldName) {
        //   x.initialValue = obj.vcertificateType; // this.createDictText(obj.vcertificateType,'1508', 1)
        // }
        // if ('ncvdidn' == x.fieldName) {
        //   x.initialValue = obj.ownerCode; //新车经销商
        // }
        // if ('ncvdidname' == x.fieldName) {
        //   x.initialValue = obj.dealerName; //新车经销商名称
        // }
        // if ('ncdcreate' == x.fieldName) {
        //   //出库日期
        //   x.initialValue = obj.aakDate; //aak
        // }
        // // if ('ncdnewinvoicen' == x.fieldName) {
        // //   //发票日期
        // //   x.initialValue = obj.invoiceDate;
        // // }
        // if ('dinvoicesum' == x.fieldName) {
        //   x.initialValue = obj.invoiceAmount;
        // }

        // if ('legalFlag' == x.fieldName) {
        //   x.initialValue = ''; /*清空本人/法人置换*/
        //   this.setOldData('N');
        // }
      });

      this.zhusunjian = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //故障现象
    guzhangxianxiangdaimanClose() {
      this.guzhangxianxiangdaima = false;
    },
    guzhangxianxiangdaimaSave(obj) {
      this.faId = obj[0].faultId;
      this.formList1.map((x) => {
        if ('faultCode' == x.fieldName) {
          x.initialValue = obj[0].faultCode; //故障现象代码返显
        }
        if ('faultName' == x.fieldName) {
          x.initialValue = obj[0].faultName; //故障现象名称返显
        }
        if ('faultAppear' == x.fieldName) {
          x.initialValue = obj[0].faultName; //故障现象名称返显
        }
        if ('sysCode1' == x.fieldName) {
          x.initialValue = obj[0].sysCode1; //一级代码
        }
        if ('sysName1' == x.fieldName) {
          x.initialValue = obj[0].sysName1; //一级名称
        }
        if ('sysCode2' == x.fieldName) {
          x.initialValue = obj[0].sysCode2; //二级代码
        }
        if ('sysName2' == x.fieldName) {
          x.initialValue = obj[0].sysName2; //二级名称
        }
        if ('sysCode3' == x.fieldName) {
          x.initialValue = obj[0].sysCode3; //三级代码
        }
        if ('sysName3' == x.fieldName) {
          x.initialValue = obj[0].sysName3; //三级名称
        }
        if ('sysCode4' == x.fieldName) {
          x.initialValue = obj[0].sysCode4; //代码
        }
        if ('sysName4' == x.fieldName) {
          x.initialValue = obj[0].sysName4; //名称
        }
        if ('sysCode' == x.fieldName) {
          x.initialValue = obj[0].sysCode; //故障代码
        }
        if ('faultAppera' == x.fieldName) {
          x.initialValue = obj[0].faultAppera; //故障现象
        }
      });

      this.guzhangxianxiangdaima = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //故障原因
    guzhangyuanyinClose() {
      this.guzhangyuanyin = false;
    },
    guzhangyuanyinSave(obj) {
      this.frId = obj[0].frId;
      this.formList1.map((x) => {
        if ('frCode' == x.fieldName) {
          x.initialValue = obj[0].frCode; //故障原因代码返显
        }
        if ('frName' == x.fieldName) {
          x.initialValue = obj[0].frName; //故障原因描述返显
        }
      });

      this.guzhangyuanyin = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //自费工单
    zifeigongdanClose() {
      this.zifeigongdanFlag = false;
    },
    zifeigongdanSave(obj) {
      this.selfNo = obj[0].selfNo;
      this.formList1.map((x) => {
        if ('selfNo' == x.fieldName) {
          x.initialValue = obj[0].selfNo; //主损件号返显
        }
        if ('selfSdate' == x.fieldName) {
          x.initialValue = obj[0].selfSdate; //自费配件销售日期返显
        }
        if ('selfMile' == x.fieldName) {
          x.initialValue = obj[0].selfMile; //自费配件销售里程返显
        }
        // if ('selfUseHours' == x.fieldName) {
        //   x.initialValue = obj[0].selfUseHours; //自费配件使用时长返显
        // }
        // if ('selfUseMile' == x.fieldName) {
        //   x.initialValue = obj[0].selfUseMile; //自费配件使用里程返显
        // }
        // if ('ncvcertnon' == x.fieldName) {
        //   x.initialValue = obj[0].certificateNo; //新车证件号
        // }
        // if ('ncvmobilen' == x.fieldName) {
        //   x.initialValue = obj.vtel; //客户电话
        // }
        // if ('ncvvinn' == x.fieldName) {
        //   x.initialValue = obj.vin; //vin
        // }
        // if ('ncvseriescoden' == x.fieldName) {
        //   x.initialValue = obj.seriesCode; //系列
        //   this.seriesCode = obj.seriesName;
        // }
        // if ('ncvseriesname' == x.fieldName) {
        //   x.initialValue = obj.seriesName; //车系名称
        //   this.seriesCode = obj.seriesName;
        // }

        // if ('ncvcartypecoden' == x.fieldName) {
        //   x.initialValue = obj.modelCode; //车型
        // }

        // if ('ncvcartypename' == x.fieldName) {
        //   x.initialValue = obj.salesModelName; //车型名称
        // }

        // if ('ncvbrandcoden' == x.fieldName) {
        //   x.initialValue = obj.brandCode; //品牌代码
        // }
        // if ('vengineanon' == x.fieldName) {
        //   //发动机号
        //   x.initialValue = obj.engineNo; //品牌代码
        // }
        // if ('vcertificateType' == x.fieldName) {
        //   x.initialValue = obj.vcertificateType; // this.createDictText(obj.vcertificateType,'1508', 1)
        // }
        // if ('ncvdidn' == x.fieldName) {
        //   x.initialValue = obj.ownerCode; //新车经销商
        // }
        // if ('ncvdidname' == x.fieldName) {
        //   x.initialValue = obj.dealerName; //新车经销商名称
        // }
        // if ('ncdcreate' == x.fieldName) {
        //   //出库日期
        //   x.initialValue = obj.aakDate; //aak
        // }
        // // if ('ncdnewinvoicen' == x.fieldName) {
        // //   //发票日期
        // //   x.initialValue = obj.invoiceDate;
        // // }
        // if ('dinvoicesum' == x.fieldName) {
        //   x.initialValue = obj.invoiceAmount;
        // }

        // if ('legalFlag' == x.fieldName) {
        //   x.initialValue = ''; /*清空本人/法人置换*/
        //   this.setOldData('N');
        // }
      });

      this.zifeigongdanFlag = false;
      this.fetchParams = { ...this.fetchParams };
    }, //维修项目
    weixiuxiangmulistClose() {
      this.weixiuxiangmulistaddflag = false;
    },
    weixiuxiangmulistSave(val) {
      console.log(val);
      this.visibleAdd = false;
      this.selectedRows = val;
      this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);

      let sumweixiufeiyong = 0;
      this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
        sumweixiufeiyong += Number(x.cmsClaimAmount);
      });
      this.feiyongformList.map((x) => {
        if ('labourAmount' == x.fieldName) {
          x.initialValue = Number(sumweixiufeiyong);
        }
      });
      this.sumweixiufeiyongz = sumweixiufeiyong;
      this.sumAmount();
      this.weixiuxiangmulistaddflag = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //配件换上件
    peijianhuanshangjianClose() {
      this.peijianhuanshangjianlistaddflag = false;
    },
    fujiaxiangmuCloseSave() {
      this.fujiaxiangmuCloselistaddflag = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //附加项目
    fujiaxiangmuClose() {
      this.fujiaxiangmulistaddflag = false;
    },
    fujiaxiangmuSave(val) {
      this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);

      let sumfujiafeiyong = 0;
      this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
        sumfujiafeiyong += Number(x.addAmount);
      });
      this.feiyongformList.map((x) => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = Number(sumfujiafeiyong);
        }
      });
      this.sumfujiafeiyongz = sumfujiafeiyong;
      this.sumAmount();
      this.fujiaxiangmulistaddflag = false;
      this.fetchParams = { ...this.fetchParams };
    },

    //配件换上件
    fujiaxiangmuCloseClose() {
      this.fujiaxiangmuCloselistaddflag = false;
    },
    peijianhuanshangjianSave(val) {
      console.log(val);
      this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(val);

      let partAmountsum = 0;
      this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
        this.sumAmountsum += Number(x.cmsClaimPrice);
        partAmountsum += Number(x.cmsClaimPrice);
      });
      this.feiyongformList.map((x) => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = partAmountsum;
        }
      });
      this.partAmountsumz = partAmountsum;
      this.sumAmount();

      // this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
      //   console.log(x.cmsClaimPrice);
      //   this.sumPeiJianFeiYong += Number(x.cmsClaimPrice);
      // });
      // this.feiyongformList.map(x => {
      //   if ('sumCmsClaimPrice' == x.fieldName) {
      //     x.initialValue = this.sumPeiJianFeiYong;
      //   }
      // });
      this.peijianhuanshangjianlistaddflag = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //作废
    async zuofei() {
      this.saveFlag = 2;
      this.saveDialog();
    }, //提交
    async submit() {
      this.formListbeizhu.find(x => x.fieldName === 'checkRemarks').rules= [{ required: true, message: '请输入审核说明', trigger: 'change' }];
      if (this.formListbeizhu.find(x => x.fieldName === 'checkRemarks').initialValue) {
        this.$refs.formPanelbeizhu.SUBMIT_FORM();
        this.loading = true;
        const res = await backAduit({ authId: this.rowData.authId,checkRemarks : this.saveData5.checkRemarks});
        if (res.resultCode === 200) {
          this.$emit('save');
          return this.$notify.success({ title: '提示信息', message: '保存成功' });
        } else {
          this.loading = false;
          // this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
          // this.closeDialog();
        }
      }else{
        this.$notify.error({title: '提示信息', message:  '保存失败,请检查数据格式和必填项!'});
      }

    },
    //取消操作
    closeDialog() {
      this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
    },
    chooseOrderNo() {
      this.visible = true;
    },
    //审核备注选择
    selectRono() {
      this.remarkFlag = true;
    },
    selectpartCode() {
      this.zhusunjian = true;
    },
    selectfaultCode() {
      this.guzhangxianxiangdaima = true;
    },
    selectfaultReason() {
      this.guzhangyuanyin = true;
    },
    selectselfNo() {
      this.zifeigongdanFlag = true;
    },
    add() {},
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '预授权单号',
          fieldName: 'authNo',
          placeholder: '请输入标题名称...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'vin',
          initialValue: '',
          disabled: true,
          placeholder: '请输入标题名称...',
          unitRender: p => {
            return (
              <div>
              <multiuse-button icon="el-icon-search" onClick={() => this.selectRono()} />
            </div>
          );
          }
        },
        // {
        //   type: 'INPUT',
        //   label: '维修工单号',
        //   fieldName: 'roNo',
        //   initialValue: '',
        //   readonly: true,
        //   placeholder: '请输入标题名称...',
        //   rules: [{ required: true, message: '请填维修工单号', trigger: 'blur' }],
        //   unitRender: p => {
        //     return (
        //       <div>
        //       <multiuse-button icon="el-icon-search" onClick={() => this.selectRono()} />
        //     </div>
        //   );
        //   }
        // },
        // {
        //   type: 'SELECT',
        //   label: '预授权状态',
        //   fieldName: 'authStatus',
        //   disabled: true,
        //   itemList:[],
        //   placeholder: '请输入标题名称...'
        // },
        // {
        //   type: 'INPUT',
        //   label: 'VIN',
        //   fieldName: 'vin',
        //   disabled: true,
        //   placeholder: '请输入标题名称...'
        // },
        {
          type: 'INPUT',
          label: '车牌号',
          fieldName: 'licenseNo',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'modelName',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        {
          type: 'INPUT',
          label: '销售日期',
          fieldName: 'saleDate',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '保修起始日期',
          fieldName: 'repairBeginDate',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '保修截止日期',
          fieldName: 'repairEndDate',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        // {
        //   type: 'DATE',
        //   label: '维修开始时间',
        //   fieldName: 'serviceBeginDate',
        //   placeholder: '请输入标题名称...',
        //   valueFormat:'yyyy-MM-DD HH:mm:ss',
        //   readonly: true, // 只读
        //   disabled: true,
        // },
        // {
        //   type: 'DATE',
        //   label: '维修结束时间',
        //   fieldName: 'serviceEndDate',
        //   placeholder: '请输入标题名称...',
        //   valueFormat:'yyyy-MM-DD HH:mm:ss',
        //   readonly: true, // 只读
        //   disabled: true,
        // },

        {
          type: 'INPUT',
          label: '发动机号/电机号',
          fieldName: 'engineNo',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        // {
        //   type: 'INPUT',
        //   label: '生产日期',
        //   fieldName: 'prodDate',
        //   disabled: true,
        //   placeholder: '请输入生产日期...'
        // },


        // {
        //   type: 'INPUT',
        //   label: '提报人',
        //   fieldName: 'serviceName',
        //   placeholder: '所属分类',
        //   disabled: true
        // },
        // {
        //   type: 'INPUT',
        //   label: '联系方式',
        //   fieldName: 'servicePhone',
        //   placeholder: '选择日期',
        //   disabled: true
        // },

        {
          type: 'INPUT',
          label: '是否特殊车辆',
          fieldName: 'isSpecial',
          disabled: true,
          placeholder: '请输入数量...',
          initialValue: undefined
        },
        {
          type: 'INPUT',
          label: '车主姓名',
          fieldName: 'customerName',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        {
          type: 'INPUT',
          label: '车主手机号',
          fieldName: 'customerPhone',
          disabled: true,
          placeholder: '请输入标题名称...'
        },
        {
          type: 'INPUT',
          label: '车辆用途',
          style: { minWidth: '200px' },
          disabled: true,
          fieldName: 'useType',
        },
        {
          type: 'INPUT',
          label: '用户属性',
          fieldName: 'customerType',
          placeholder: '',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '上次维修里程',
          fieldName: 'lastDrive',
          disabled: true,
          initialValue: '',
          unitRender: () => {
            return <span>(KM)</span>;
          },
        },
        {
          type: 'INPUT',
          label: '行驶里程',
          unitRender: () => {
            return <span>(KM)</span>;
          },
          fieldName: 'driveMile',
          disabled: true,
          placeholder: '请输入行驶里程...'
        },
        {
          type: 'INPUT',
          label: '送修人姓名',
          fieldName: 'deliverer',
          disabled: true,
          placeholder: '请输入送修人姓名...'
        },
        {
          type: 'INPUT',
          label: '送修人手机号',
          fieldName: 'delivererMobile',
          disabled: true,
          placeholder: '请输入送修人手机号...'
        },
      ];
    },
    createFormList1() {
      return [
        { type: 'SELECT', label: '索赔类型', fieldName: 'cmsClaimType', placeholder: '请选择', disabled: true, initialValue: '', itemList: [] },
        {
          type: 'INPUT',
          label: '主损件',
          fieldName: 'partCode',
          disabled: true,
          initialValue: '',
          placeholder: '请输入数量...',
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectpartCode()} />
              </div>
            );
          },
        },
        {
          type: 'INPUT',
          label: '主损件名称',
          fieldName: 'partName',
          disabled: true,
          initialValue: '',
          placeholder: '请输入数量...',
        },
        { type: 'SELECT', label: '供应商', fieldName: 'supName', placeholder: '请选择', initialValue: '', disabled: true, itemList: [] },
        {
          type: 'INPUT',
          label: '故障现象代码',
          fieldName: 'faultCode',
          disabled: true,
          initialValue: '',
          placeholder: '请输入数量...',
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
              </div>
            );
          },
        },
        {
          type: 'INPUT',
          label: '故障现象描述',
          fieldName: 'faultName',
          disabled: true,
          initialValue: '',
          placeholder: '请输入数量...',
        },
        {
          type: 'INPUT',
          label: '一级代码',
          fieldName: 'sysCode1',
          disabled: true,
          placeholder: '请输入数量...',
        },

        {
          type: 'INPUT',
          label: '一级名称',
          fieldName: 'sysName1',
          disabled: true,
          placeholder: '请输入数量...',
        },
        {
          type: 'INPUT',
          label: '二级代码',
          fieldName: 'sysCode2',
          disabled: true,
          placeholder: '请输入数量...',
        },

        {
          type: 'INPUT',
          label: '二级名称',
          fieldName: 'sysName2',
          disabled: true,
          placeholder: '请输入数量...',
        },
        {
          type: 'INPUT',
          label: '三级代码',
          fieldName: 'sysCode3',
          disabled: true,
          placeholder: '请输入数量...',
        },

        {
          type: 'INPUT',
          label: '三级名称',
          fieldName: 'sysName3',
          disabled: true,
          placeholder: '请输入数量...',
        },

        {
          type: 'INPUT',
          label: '故障代码',
          fieldName: 'sysCode4',
          disabled: true,
          placeholder: '请输入数量...',
        },
        {
          type: 'INPUT',
          label: '故障现象',
          fieldName: 'sysName4',
          disabled: true,
          placeholder: '请输入数量...',
        },

        {
          type: 'INPUT',
          label: '故障原因代码',
          fieldName: 'frCode',
          disabled: true,
          placeholder: '请输入数量...',
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultReason()} />
              </div>
            );
          },
        },
        {
          type: 'INPUT',
          label: '故障原因描述',
          disabled: true,
          fieldName: 'frName',
          placeholder: '请输入数量...',
        },
        //
        // {
        //   type: 'INPUT',
        //   label: '外出救援单号',
        //   fieldName: 'outNo',
        //   //fieldName: 'outCode',
        //   disabled: true,
        //   placeholder: '请输入救援单号...',
        //   unitRender: (p) => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectoutNo()} />
        //       </div>
        //     );
        //   },
        // },
        {
          type: 'INPUT',
          label: '自费工单选择',
          fieldName: 'selfNo',
          disabled: true,
          placeholder: '请输入数量...',
          unitRender: p => {
            return (
              <div>
              <multiuse-button icon="el-icon-search" onClick={() => this.selectselfNo()} />
            </div>
          );
          }
        },
        {
          type: 'DATE',
          label: '自费配件销售日期',
          fieldName: 'selfSdate',
          disabled: true,
          valueFormat:'yyyy-MM-DD',
          placeholder: '请输入数量...'
        },
        {
          type: 'INPUT',
          label: '自费配件销售里程',
          fieldName: 'selfMile',
          disabled: true,
          placeholder: '请输入数量...'
        },
        // {
        //   type: 'INPUT',
        //   label: '自费配件使用时长',
        //   disabled: true,
        //   fieldName: 'selfUseHours',
        //   placeholder: '请输入数量...'
        // },
        // {
        //   type: 'INPUT',
        //   label: '自费配件使用里程',
        //   disabled: true,
        //   fieldName: 'selfUseMile',
        //   placeholder: '请输入数量...'
        // },
        {
          type: 'TEXT_AREA',
          label: '故障现象',
          fieldName: 'faultAppear',
          disabled: true,
          rows: 3,
          selfCols: 4, // 元素占据几行
        },
        {
          type: 'TEXT_AREA',
          label: '故障原因',
          fieldName: 'faultReason',
          placeholder: '故障原因',
          disabled: true,
          rows: 3,
          selfCols: 4, // 元素占据几行
        },
        {
          type: 'TEXT_AREA',
          label: '维修方案',
          fieldName: 'cmsClaimPgm',
          placeholder: '维修方案',
          disabled: true,
          rows: 3,
          selfCols: 4, // 元素占据几行
        },
        {
          type: 'BREAK_SPACE',
          label: '附件'
        },
        {
          type: 'UPLOAD_IMG',
          label: 'VIN',
          fieldName: 'wayPicture',
          placeholder: '上传身份证...',
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_IMG',
          label: '里程（仪表）',
          fieldName: 'wayPicture1',
          placeholder: '上传身份证...',
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_IMG',
          label: '车牌（车头）',
          fieldName: 'wayPicture2',
          placeholder: '上传身份证...',
          offsetRightCols: 1,
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_IMG',
          label: '行驶证',
          fieldName: 'wayPicture3',
          placeholder: '上传身份证...',
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_IMG',
          label: '故障照片',
          fieldName: 'wayPicture4',
          placeholder: '上传身份证...',
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_IMG',
          label: '故障照片',
          fieldName: 'wayPicture5',
          placeholder: '上传身份证...',
          rules: [
            { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' },
          ],
          upload: {
            actionUrl: '/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          readonly: true, // 只读
          disabled: true, // 置会
        },
      ];
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          fixed: 'left',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        // {
        //   title: '操作',
        //   dataIndex: 'column-action',
        //   width: 90,
        //   render: (props, h) => {
        //     return (
        //       <div>
        //         <el-button size="mini" type="text" onClick={() => this.video(props.row)}>
        //           预览
        //         </el-button>
        //       </div>
        //     );
        //   }
        // },
        {
          title: '附件标题',
          dataIndex: 'title',
          showOverflowTooltip: true,
          render: p => {
            return (
              <a style="color:#bb0a30" href={p.row.fileUrl} target="_blank" download={p.row.title}>
                {p.row.title}
              </a>
            );
          }
        },
        {
          title: '上传日期',
          dataIndex: 'createdAt'
        },
      ];
    },
    //维修项目列表
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        { title: '维修项目代码', dataIndex: 'labourCode', sorter: true },
        { title: '维修项目名称', dataIndex: 'labourName', sorter: true },
        { title: '收费区分', dataIndex: 'cmsClaimType', sorter: true },
        { title: '标准工时', dataIndex: 'labourHours', sorter: true },
        { title: '索赔工时单价', dataIndex: 'cmsClaimPrice', sorter: true },
        { title: '索赔金额', dataIndex: 'cmsClaimAmount', sorter: true },
      ];
    },
    //配件换上件列表
    creatHeader1() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        { title: '配件代码', dataIndex: 'partCode', sorter: true },
        { title: '配件名称', dataIndex: 'partName', sorter: true },
        { title: '单位', dataIndex: 'partUnit', sorter: true },
        { title: '数量', dataIndex: 'partCount', sorter: true },
        { title: '索赔单价', dataIndex: 'cmsClaimPrice', sorter: true },
        { title: '索赔总价', dataIndex: 'cmsClaimAmount', sorter: true },
        // { title: '是否电池', dataIndex: 'ifEv', sorter: true },
        // { title: '电池编号', dataIndex: 'evNo', sorter: true },
      ];
    },
    //换下件
    columnshuanxiajianFn() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        // {
        //   title: '操作',
        //   dataIndex: 'column-action',
        //   width: 80,
        //   render: (props) => {
        //     return (
        //       <div style="text-align:center">
        //         <multiuse-button type="text" disabled={(this.flag)} onClick={() => this.delsFunXj(props.row)} >
        //           删除
        //         </multiuse-button>
        //       </div>
        //     );
        //   },
        // },
        { title: '配件代码', dataIndex: 'partCode', sorter: true },
        { title: '配件名称', dataIndex: 'partName', sorter: true },
        { title: '单位', dataIndex: 'partUnit', sorter: true },
        // { title: '剩余数量', dataIndex: 'lessCount', sorter: true },
        { title: '数量', dataIndex: 'partCount', editable: false,
          editType: 'number',
          // editRequired: true,
          editValidator:(val, row, callback) => {
            // this.$refs.table1.$refs.pageTable.list.map((x) => {
            //   if (row.partCode == x.partCode) {
            //    this.number = x.partCount
            //   }
            // });
            // if (row.partCount > this.number) {
            //   this.$notify.error({ title: '提示信息', message: '已超过换上件最大数量(' + this.number + ')' || '操作失败!' });
            //   row.partCount = 1
            // }else
            if(row.partCount<0){
              this.$notify.error({ title: '提示信息', message: '换下件最小数量为0' });
              row.partCount = 0
            }
          }

        },
        // { title: '配件回运类型', dataIndex: 'returnType', sorter: true, dictItems:[] },
        // { title: '配件代码', dataIndex: 'partId', hidden: true },
      ];
    },
    //附加项目列表
    columnsfujiaxiangmu1() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 130,
          render: props => {
            return (
              <div style="text-align:center">
                <multiuse-button type="text" onClick={() => this.editFile(props.row)} >
                  上传附件
                </multiuse-button>
              </div>
            );
          }
        },
        { title: '附加项目代码', dataIndex: 'addCode', sorter: true },
        { title: '附加项目名称', dataIndex: 'addName', sorter: true },
        { title: '附加项目费用', dataIndex: 'addAmount', sorter: true },
        { title: '备注', dataIndex: 'addRemark', sorter: true },
      ];
    },
    //费用信息
    feiyongformList1() {
      return [
        {
          type: 'INPUT',
          label: '合计费用',
          fieldName: 'sumAmount',
          initialValue: 0,
          readonly: true, // 只读
        },
        {
          type: 'INPUT',
          label: '工时费用',
          fieldName: 'labourAmount',
          initialValue: 0,
          readonly: true, // 只读
        },
        {
          type: 'INPUT',
          label: '配件费用',
          fieldName: 'partAmount',
          initialValue: 0,
          readonly: true, // 只读
        },
        {
          type: 'INPUT',
          label: '附加项目费用',
          fieldName: 'addAmount',
          initialValue: '',
          readonly: true, // 只读
        },
      ];
    },
    //审核备注
    formListbeizhuform() {
      return [
        {
          type: 'INPUT',
          label: '审核备注',
          fieldName: 'checkRemarks',
          placeholder: '请输入备注...',
          initialValue:'',
          row:3,
          unitRender: p => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={() => this.selectRono()} />
              </div>
            );
          },
          rules: [{ required: false, message: '请输入', trigger: 'blur' }]
        }
      ];
    },
  /**维修项目删除方法 */
    deleteFunweixiu(costItem) {
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(async () => {
          this.$notify({
            title: '提示信息',
            message: '删除成功',
            type: 'success',
          });
          this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]); //cmsClaimAmount
          this.feiyongformList.map((x) => {
            if ('labourAmount' == x.fieldName) {
              x.initialValue = this.sumweixiufeiyongz - Number(costItem.cmsClaimAmount);
              this.sumAmount();
            }
          });
        })
    } /**配件换上件删除方法 */,
    deleteFunshangjian(costItem) {
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(async () => {
          this.$notify({
            title: '提示信息',
            message: '删除成功',
            type: 'success',
          });
          this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_DELETE([costItem]);
          this.feiyongformList.map((x) => {
            if ('partAmount' == x.fieldName) {
              x.initialValue = this.partAmountsumz - Number(costItem.cmsClaimPrice);
              this.sumAmount();
            }
          });
        })
    } /*附加项目删除方法 */,
    deleteFunfujia(costItem) {
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(async () => {
          this.$notify({
            title: '提示信息',
            message: '删除成功',
            type: 'success',
          });
          this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]);
          this.feiyongformList.map((x) => {
            if ('addAmount' == x.fieldName) {
              x.initialValue = this.sumfujiafeiyongz - Number(costItem.addAmount);
              this.sumAmount();
            }
          });
        })
    },
  },
};
</script>

<style lang="less" scoped></style>
